package cn.dxs.gitee.mvp.contract.base;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

/**
 * Contract基类(MVP各层业务的交互通过接口联系)
 *
 * @author lijian
 * @date 2019-09-20 23:13
 */
public class IBaseContract {

    public interface View {

        void showProgressDialog(String content);

        void dismissProgressDialog();

        ProgressDialog getProgressDialog(String content);

        void showTipDialog(String msg);

        void showConfirmDialog(String msg, String title, String confirmText, DialogInterface.OnClickListener confirmListener);

        void showToast(String message);

        void showInfoToast(String message);

        void showSuccessToast(String message);

        void showErrorToast(String message);

        void showWarningToast(String message);

        void showLoading();

        void hideLoading();

        void showLoginPage();
    }

    public interface Presenter<V extends IBaseContract.View> {

        void onSaveInstanceState(Bundle outState);

        void onRestoreInstanceState(Bundle outState);

        void attachView(@NonNull V view);

        void detachView();

        /**
         * view已初始化，可以初始化view数据
         */
        void onViewInitialized();

        @Nullable
        Context getContext();
    }
}
